package com.vibration.matlab;

import com.mathworks.toolbox.javabuilder.MWClassID;
import com.mathworks.toolbox.javabuilder.MWException;
import com.mathworks.toolbox.javabuilder.MWNumericArray;
import com.mathworks.toolbox.javabuilder.MWStringArray;
import com.vibration.common.config.VibrationConfig;
import com.vibration.socket.util.SocketUtil;
import getPlotRight.GetRightPlot;

/**
 * 得到右边曲线图
 */
public class GetPlotRight {

    /**
     * double[][] HVDS=c.getHVDS();
     *        //x轴
     *        double[][] HVFobs=c.getHVFobs();
     *        //黑线y轴
     *         double[][] HVAobs=c.getHVAobs();
     *        //红线y轴
     *         HVopt=transInfo.getHVopt();
     */
    public static String getRightPlot(double[][] HVDS,double[][] HVFobs,double[][] HVAobs,double[][] HVopt) throws MWException {
        GetRightPlot getRightPlot=new GetRightPlot();
        MWNumericArray matHVDS = new MWNumericArray(HVDS, MWClassID.DOUBLE);
        MWNumericArray matHVFobs = new MWNumericArray(HVFobs, MWClassID.DOUBLE);
        MWNumericArray matHVAobs = new MWNumericArray(HVAobs, MWClassID.DOUBLE);
        MWNumericArray matHVopt = new MWNumericArray(HVopt, MWClassID.DOUBLE);
        //String filePath=File.filePath;
        String filePath= VibrationConfig.getInversionPath()+"/"+ SocketUtil.inversionTask+"/";
        //如果目录不存在则创建
        java.io.File desc = new java.io.File(filePath+"right.jpg");
        if (!desc.exists())
        {
            if (!desc.getParentFile().exists())
            {
                desc.getParentFile().mkdirs();
            }
        }
        //String fileName="LeftPlot"+FileNameUtil.getFileName();
        String fileName="right";
       // String filePath= File.filePath;
        //String fileName="RightPlot"+FileNameUtil.getFileName();
        MWStringArray stringArrayPath=new MWStringArray(filePath);
        MWStringArray stringArrayName=new MWStringArray(fileName);
        getRightPlot.getPlotRight(matHVFobs,matHVAobs,matHVDS,matHVopt,stringArrayPath,stringArrayName);

        return fileName;
    }
}
